import request from '../../utils/request';
import {isEmptyValue} from '../../utils/publicFunction';
const state = {
    _this: [],//vue实例,可用于调用vue方法，原vue实例内的this方法
    order_type:[
        {
            value: 1,
            label: '黑卡会员',
        },
        {
            value: 2,
            label: '课程',
        },
        {
            value: 3,
            label: '达人探店',
        },
        {
            value: 4,
            label: '霸王餐',
        },
    ],
    vips:[
        {
            value: 1,
            label:'初级会员',
        },
        {
            value: 2,
            label:'高级会员',
        }
    ],
    courses:[],

};
const getters = {
};

const mutations = {

};
const actions = {

    getCourses(){
        if(isEmptyValue(state.courses)){
            request.post('/api/common/enums',{type:'course'}).then(result => {
                if (result.code === 0) {
                    state.courses = result.data
                } else {
                    state._this.$message.error('数据加载异常');
                }
            }).catch(e => {
                state._this.$message.error('数据加载异常');
                console.log(e);
            })
        }
    },
};

export default{
    namespaced: true,
    state,
    getters,
    mutations,
    actions,
}
